<script setup>

const props = defineProps({
  defaultFooter: {
    type: Boolean,
    default: () => true
  },
  _dialogVisible: {
    type: Boolean,
    default: () => false
  },
  mTitle: {
    type: String || Number,
    default: () => ''
  }
})
const emit = defineEmits(['update:_dialogVisible', 'dialogFixHandle'])
const updateDialogVisible = (value) => {
  emit('update:_dialogVisible', value)
}

const dialogVisible = computed({
  get: () => {
    return props._dialogVisible
  },
  set: (newVal) => {
    emit('update:_dialogVisible', newVal)
  }
})
</script>
<template>
  <el-dialog
    v-model="dialogVisible"
    v-bind="$attrs"
    :title="mTitle"
    draggable
    destroy-on-close
    @closed="updateDialogVisible(false)"
  >
    <!-- 提供一个插槽 -->
    <slot></slot>
    <template #footer v-if="defaultFooter">
      <el-button @click="updateDialogVisible(false)">取 消</el-button>
      <el-button type="primary" @click="emit('dialogFixHandle')">确 定</el-button>
    </template>
    <template #footer v-else>
      <el-button type="primary" @click="updateDialogVisible(false)">关 闭</el-button>
    </template>
  </el-dialog>
</template>
<style lang="scss"></style>
